// SourceEditorDlgBar.cpp : implementation file
//

#include "stdafx.h"
#include "ogleditor.h"
#include "SourceEditor.h"


// SourceEditorDlgBar

IMPLEMENT_DYNAMIC(SourceEditorDlgBar, CDialogBar)

SourceEditorDlgBar::SourceEditorDlgBar()
{

}

SourceEditorDlgBar::~SourceEditorDlgBar()
{
}

void SourceEditorDlgBar::DoDataExchange(CDataExchange* pDX)
{
	CDialogBar::DoDataExchange(pDX);

	DDX_Control(pDX, IDC_EDIT_SOURCE, m_edit);
}

BEGIN_MESSAGE_MAP(SourceEditorDlgBar, CDialogBar)
	ON_MESSAGE(WM_INITDIALOG, OnInitDialog)
	ON_WM_SIZE()
END_MESSAGE_MAP()



// SourceEditorDlgBar message handlers

LONG SourceEditorDlgBar::OnInitDialog(UINT, LONG)
{
	CRect rcForm;
	GetClientRect(&rcForm);

	UpdateData(FALSE);

	return TRUE;
}



void SourceEditorDlgBar::OnSize(UINT nType, int cx, int cy)
{
	CDialogBar::OnSize(nType, cx, cy);
	
	CRect rcForm;
	GetClientRect(&rcForm);
	CRect rcTemp;

	int nMargin = 0;
	int nLeft = nMargin;
	int nWidth = rcForm.Width() - nMargin - nLeft;
	if (m_edit.GetSafeHwnd())
	{
		m_edit.GetWindowRect(&rcTemp);
		ScreenToClient(&rcTemp);
		m_edit.MoveWindow(nLeft, rcTemp.top, nWidth, rcTemp.Height());
	}
}
